package ysu.sxm.ptjc.Controller;

import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ysu.sxm.ptjc.Domin.Daily;
import ysu.sxm.ptjc.Service.DailyStatisticsService;

import java.sql.Date;
import java.util.List;

@RestController
public class DailyInfoServlet {
    @Autowired
    DailyStatisticsService dailyStatisticsService;
    @GetMapping(path = "/daily")
    public String dailyInfo(@RequestParam("day") String day){
        Date req = Date.valueOf(day);
        return JSONArray.toJSONString(dailyStatisticsService.getAllByDate(req));
    }
}
